{layout name="../../admin/view/layout/main" /}
{:breadcrumb(['UI 示例:example/layout/index', '示例页面:example/pages/index', '模态框的最大化'])}
<style>
    .modal-fullscreen-btn {
        border: none;
        background-color: transparent;
        color: #000;
        opacity: 0.6;
        font-size: 22px;
        line-height: 1.3;
        font-weight: 700;
        margin: -0.5rem -0.5rem -0.5rem auto;
    }
    .modal-fullscreen-btn .mdi:before {
        width: 1.5rem;
        height: 1.5rem;
        vertical-align: middle;
        content: "\f0293";
        line-height: 1;
    }
    .modal-fullscreen-btn:hover {
        opacity: .8;
    }
    .modal-fullscreen {
        padding-left: 0px!important;
    }
    .modal-fullscreen .modal-fullscreen-btn {
        opacity: .95;
    }
    .modal-fullscreen .modal-fullscreen-btn .mdi:before {
        content: "\f0294";
    }
    .modal-fullscreen .modal-dialog {
        width: -webkit-calc(100% - 20px);
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        margin: 8px auto;
    }
    .modal-fullscreen .modal-dialog .modal-body {
        height: -webkit-calc(100vh - 56px - 69px - 20px);
        height: calc(100vh - 56px - 69px - 20px);
        overflow-y: auto;
    }
    </style>
    <div class="row">

        <div class="col-lg-12">
          <div class="card">
            <div class="card-body">
            
            <p>其实v5已经有了模态框的最大化。</p>
              <p>这里旨在对模态框增加最大化的功能(因为是模态框的原因，在保留模态框的一些样式基础上最最大化处理)。css和绑定事件的js可以放到通用的文件当中，模态框新增最大化按钮即可。</p>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal">
              打开模态框
            </button>
            <div class="modal fade" id="myModal">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-header">
                    <h6 class="modal-title" id="myModalLabel">标题</h6>
                    <div class="float-end">
                      <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                      <button type="button" class="modal-fullscreen-btn"><i class="mdi"></i></button>
                    </div>
                  </div>
                  <div class="modal-body">
                  内容
                  </div>
                  <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary">保存</button>
                  </div>
                </div>
              </div>
            </div>
            
            </div>
          </div>
      </div>
  
    </div>
    <script type="text/javascript">
        $(document).ready(function() {
            $(document).on('click', '.modal-fullscreen-btn', function(){
                $(this).closest('.modal').toggleClass('modal-fullscreen');
            });
        });
        </script>